package com.jiang.demo.depotstable.type;

import com.jiang.demo.depotstable.domain.Type;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiangzhe
 * @create 2021/5/12 14:40
 */
@Slf4j
@RestController
@RequestMapping(value = "/type")
public class TypeController {

    @Autowired
    TypeService typeService;

    @GetMapping(value = "add")
    public String addStore(@RequestParam(required = true) String name){
        Type type = new Type();
        type.setName(name);
        typeService.insertStore(type);
        return type.toString()+"\tsuccess";
    }
}
